import http from "@/utils/http/hub";

/**
 * 获取地址列表
 */
export const getAddressList = (
  params,
  config = {
    custom: {
      auth: true,
    },
  }
) => {
  return http.post({
    url: `/userAddress/getList`,
    params,
    config,
  });
};

/**
 * 添加地址
 */
export const createAddress = (
  params,
  config = {
    custom: {
      auth: true,
    },
  }
) => {
  return http.post({
    url: `/userAddress/create`,
    params,
    config,
  });
};

/**
 * 编辑地址
 */
export const editAddress = (
  params,
  config = {
    custom: {
      auth: true,
    },
  }
) => {
  return http.post({
    url: `/userAddress/update`,
    params,
    config,
  });
};

/**
 * 删除地址
 * userAddressId 地址id
 */
export const delAddress = (
  params,
  config = {
    custom: {
      auth: true,
    },
  }
) => {
  return http.post({
    url: `/userAddress/destroy`,
    params,
    config,
  });
};

/**
 * 获取地址详情
 * userAddressId 地址id
 */
export const getAddressDetail = (
  params,
  config = {
    custom: {
      auth: true,
    },
  }
) => {
  return http.post({
    url: `/userAddress/detail`,
    params,
    config,
  });
};
